function bankIn(){
    this.bankcards = {};
	this.timecount=60;
}
bankIn.prototype.submitNewAddr = function(){
    // new_label = $('#new_label').val();
    // if(!new_label){
    //     this.fade('#showMsg_address', '请添加标签');
    //     return false;
    // }
    bank = $('#bank :selected').html();
    if(bank == '请选择银行'){
        this.fade('#showMsg_address','请选择银行');
        return false;
    }
    account = $('#account').val();
    if(!account){
        this.fade('#showMsg_address', '请填写银行卡号');
        return false;
    }
    name = $('#name').val();
    if(!name){
        this.fade('#showMsg_address', '请填写银行卡开户名');
        return false;
    }
    // iscaptcha = $("input[name=iscaptcha]").val();
//	captcha=$('#img_captcha').val();
//	if(!captcha){
//		this.fade('#showMsg_address', '图形验证码错误或为空');
//        $("div.phone_code").unbind('click');
//		return false;
//	}
    // $("div.phone_code").unbind('click');
	// phoneCode = $("#phone_code_bank").val();
	// if(!phoneCode){
    //     this.fade('#showMsg_address', '请填写短信验证码');
    //     return false;
    // }

	this.finaddAddress();
}
bankIn.prototype.finaddAddress = function(){
	this.bankcards = {'bank':bank, 'account':account, 'name':name}
    var data = this.bankcards;
    data['code'] = $('#phone_code_bank').val();
	// if(count>=5){
	// 	data['captcha'] = captcha;
	// }
    this.ajaxSubmit(data, '/user_assets/inbank', 'post', false);
}

bankIn.prototype.fade = function(id, words){
    $(id).html(words).fadeOut().fadeIn().fadeOut().fadeIn().fadeOut().fadeIn();
}

bankIn.prototype.ajaxSubmit = function(data, url, type, async){
    $.ajax({
        type: type,
        url: url,
        data:data,
        dataType: "json",
        async: async,
        success: function(data){
            var str = eval(data);
            if(str.code == 1){
				if(str.errmsg == '验证码错误'){
					count++;
				}
                alert(str.errmsg);
            }else{
                alert(str.errmsg);
                Fnc.reload_page();
            }
        }
    });
}

bankIn.prototype.delAddr = function(id){
    data = {};
    data['id'] = id;
    this.ajaxSubmit(data, '/user_assets/deladdr', 'post', false);
}

bankIn = new bankIn();
